﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Microsoft.Practices.WizardFramework;
using System.ComponentModel.Design;

namespace ProjectBase.Guidance.CustomWizardPages
{
    /// <summary>
    /// Example of a class that is a custom wizard page
    /// </summary>
    public partial class EntityTypePage : Microsoft.Practices.WizardFramework.CustomWizardPage
    {
        public EntityTypePage(WizardForm parent)
            : base(parent)
        {
            InitializeComponent();
        }

        private void StoreArguments_Click(object sender, EventArgs e)
        {
            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
            dictionaryService.SetValue("IsCodeList", radioButton02.Checked || radioButton03.Checked);
            if (radioButton02.Checked || radioButton03.Checked)
            {
                dictionaryService.SetValue("Namespace", "CodeLists");
            }
            dictionaryService.SetValue("UseSimpleCodeList", radioButton03.Checked);
            dictionaryService.SetValue("UseRootOnly", RootNamespaceOnly.Checked);
            SelectedValue(sender, e);
        }

        private void SelectedValue(object sender, EventArgs e)
        {
            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;
            dictionaryService.SetValue("IDType", IdTypeSelector.SelectedItem);
            dictionaryService.SetValue("DaoBase", DaoBaseSelector.SelectedItem);
            if (radioButton02.Checked || radioButton03.Checked)
            {
                dictionaryService.SetValue("IDType", "int");
            }
            dictionaryService.SetValue("UseRootOnly", RootNamespaceOnly.Checked);
        }

        public bool Persistent
        {
            get { return this.radioButton01.Checked; }
            set { this.radioButton01.Checked = value; }
        }

        [RecipeArgument]
        public bool IsCodeList { get; set; }

        [RecipeArgument]
        public bool UseSimpleCodeList { get; set; }

        [RecipeArgument]
        public bool UseRootOnly { get; set; }

        [RecipeArgument]
        public string IDType { get; set; }
        //[RecipeArgument]
        //public string DaoBase { get; set; }


    }
}
